<template>
  <div>
    <div class="right_proaducts">我的位置&gt;&gt;科技项目申报&gt;专家信息</div>
    <div id="container">
      <div id="content2">
        <table width="100%" height="41" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="15" height="18" align="left" valign="top">
              <div align="left"></div>
            </td>
            <td width="385" align="left" valign="bottom" class="12">&nbsp;</td>
          </tr>
          <tr>
            <td height="4" colspan="2" align="left" valign="bottom"></td>
          </tr>
          <tr>
            <td height="15" align="left" valign="top">&nbsp;</td>
            <td height="15" align="left" valign="top" class="12">
              <table width="100%" height="20" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td height="20">
                      <br/>
                    <div class=padding>
                      <div id=middlebody>
                        <table width="50%" border="0" align="center" cellpadding="0"
                               cellspacing="1">
                          <tbody>
                          <tr>
                            <td width="17%" height="20" align="right" bgcolor="#f3f3f3">名称</td>
                            <td width="3%" height="20" align="right" bgcolor="#f3f3f3">&nbsp;
                            </td>
                            <td height="20" colspan="2" bgcolor="#f3f3f3"><input type="text"
                                                                                 v-model="expert.name"
                            />
                            </td>
                          </tr>
                          <tr>
                            <td height="20" align="right" bgcolor="#f3f3f3">单位名称</td>
                            <td height="20" align="right" bgcolor="#f3f3f3">&nbsp;</td>
                            <td height="20" colspan="2" bgcolor="#f3f3f3"><input type="text"
                                                                                 v-model="expert.unitname"
                                                                                 name="unitname"
                                                                                 id="unitname"/>
                            </td>
                          </tr>
                          <tr>
                            <td height="20" align="right" bgcolor="#f3f3f3">国籍</td>
                            <td height="20" align="right" bgcolor="#f3f3f3">&nbsp;</td>
                            <td height="20" colspan="2" bgcolor="#f3f3f3"><input type="text"
                                                                                 v-model="expert.nation"
                                                                                 name="nation"
                                                                                 id="nation"/>
                            </td>
                          </tr>
                          <tr>
                            <td height="20" align="right" bgcolor="#f3f3f3">性别</td>
                            <td height="20" align="right" bgcolor="#f3f3f3">&nbsp;</td>
                            <td height="20" colspan="2" bgcolor="#f3f3f3"><select
                                v-model="expert.sex" name="sex">
                              <option value="1">男</option>
                              <option value="0">女</option>
                            </select></td>
                          </tr>
                          <tr>
                            <td height="20" align="right" bgcolor="#f3f3f3">职称</td>
                            <td height="20" align="right" bgcolor="#f3f3f3">&nbsp;</td>
                            <td height="20" colspan="2" bgcolor="#f3f3f3"><input type="text"
                                                                                 v-model="expert.title"
                                                                                 name="title"
                                                                                 id="title"/>
                            </td>
                          </tr>
                          <tr>
                            <td height="20" align="right" bgcolor="#f3f3f3">电话</td>
                            <td height="20" align="right" bgcolor="#f3f3f3">&nbsp;</td>
                            <td height="20" colspan="2" bgcolor="#f3f3f3"><input type="text"
                                                                                 v-model="expert.tel"
                                                                                 name="tel"
                                                                                 id="tel"/></td>
                          </tr>
                          <tr>
                            <td height="20" align="right" bgcolor="#f3f3f3">简介</td>
                            <td height="20" align="right" bgcolor="#f3f3f3">&nbsp;</td>
                            <td height="20" colspan="2" bgcolor="#f3f3f3"><input type="text"
                                                                                 v-model="expert.introduction"
                                                                                 name="introduction"
                                                                                 id="introduction"/>
                            </td>
                          </tr>
                          <tr>
                            <td height="30" colspan="2" bgcolor="#f3f3f3">&nbsp;</td>
                            <td width="22%" height="30" bgcolor="#f3f3f3"><input type="button"
                                                                                 @click="updateInfo()"
                                                                                 value="修改"/>
                            </td>
                            <td width="58%" height="30" bgcolor="#f3f3f3"><input type="submit"
                                                                                 name="Submit2"
                                                                                 value="取消"/>
                            </td>
                          </tr>
                          </tbody>
                        </table>
                      </div>
                    </div>
                  </td>
                </tr>
              </table>
              <br/>
              <div class="table_wz"></div>
            </td>
          </tr>
        </table>
      </div>
    </div>
    <div id="container">
      <div id="footer">
        <p><a href="http://www.ascenttech.com.cn/" target="_blank">版权所有：北京亚思晟商务科技有限公司 &copy;2004-2008|京ICP备05005681</a>
        </p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "expertInfo",
  data() {
    return {
      expert: {
        uid: JSON.parse(sessionStorage.getItem("userInfo")).uid || '',
        sex: JSON.parse(sessionStorage.getItem("userInfo")).sex || '',
        unitname: JSON.parse(sessionStorage.getItem("userInfo")).unitName || '',
        name: JSON.parse(sessionStorage.getItem("userInfo")).name || '',
        title: JSON.parse(sessionStorage.getItem("userInfo")).title || '',
        tel: JSON.parse(sessionStorage.getItem("userInfo")).tel || '',
        introduction: JSON.parse(sessionStorage.getItem("userInfo")).introduction || '',
        nation: JSON.parse(sessionStorage.getItem("userInfo")).nation || ''
      }
    }
  },
  mounted() {
  },
  methods: {
    //注销
    logout() {
      sessionStorage.clear();
    },
    updateSession(value){
      sessionStorage.setItem("userInfo",value);
    },
    updateInfo() {
      var _this = this;
      this.$axios({
        url: 'http://localhost:8080/api/expert/updateByName',
        method: 'post',
        data: _this.expert
      }).then((res) => {
        if (res.data.code == 200) {
          alert("修改成功");
          this.updateSession(JSON.stringify(_this.expert));
          this.$router.push("/declare/expert/index");
        } else {
          alert("修改失败");
        }
      })
    }
  }
}
</script>

<style scoped>

</style>
